Skip to content

Commit

Permalink
update gh-pages with the modif from master
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonny committed Feb 10, 2015
1 parent 77be2d8 commit 3d476f4
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 20 deletions.
12 changes: 7 additions & 5 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,17 @@ If you have never used your GitHub Pages domain before, you can use this procedu

IMPORTANT: If you are currently using your `username.github.io` GitHub Pages domain for another project, or if you want to use a custom domain name, skip to the next procedure for instructions.

. Rename your repository to `<username>.github.io`

. Set values in `hubpress/config.json`
+
image:http://hubpress.io/img/edit-config.png[Edit config]
+
The following parameters are mandatory :
+
* `username`, which is your GitHub user name,
* `repositoryName`, which is the repository fork. For example, `hubpress.io` if you did not rename it.
. Commit the changes, and open the GitHub Pages domain: `http://<username>.github.io/<repositoryName>/`.
* `repositoryName`, which is the new name of the repository fork, `<username>.github.io`.
. Commit the changes, and open the GitHub Pages domain: `http://<username>.github.io/`.
. The following screen indicates you have correctly configured HubPress
+
image:http://hubpress.io/img/home-install.png[Install complete,300]
Expand Down Expand Up @@ -122,7 +124,7 @@ When you first start HubPress, the *Posts* view is empty. As you create blog pos

=== Creating a Post

NOTE: If you have never used AsciiDoc before to write content, the http://asciidoctor.org/docs/asciidoc-writers-guide/#lists-lists-lists[AsciiDoctor Writer's Guide] should be your first stop in your journey. The guide provides both basic and advanced mark-up examples for you to copy and use.
NOTE: If you have never used AsciiDoc before to write content, the http://asciidoctor.org/docs/asciidoc-writers-guide/[AsciiDoctor Writer's Guide] should be your first stop in your journey. The guide provides both basic and advanced mark-up examples for you to copy and use.

HubPress Editor displays the AsciiDoc code on the left, and the live preview on the right.

Expand All @@ -147,13 +149,13 @@ For example :

===== Publication date

By default, the publication date is the date of the day to which you introduced your Blog Post. You can force the publication date by adding the `published_date`
By default, the publication date is the date of the day to which you introduced your Blog Post. You can force the publication date by adding the `published_at`

For example :
[source, asciidoc]
----
= Blog Title
:published_date: 2015-01-31
:published_at: 2015-01-31
----

===== Tags and Categories
Expand Down
54 changes: 43 additions & 11 deletions hubpress/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,11 @@ Hubpress.prototype.showNotification = function (message) {
};
if (message.type === "error") {
this.refs.toastr.error(message.content, message.title, options);
} else {
}
if (message.type === "warning") {
this.refs.toastr.warning(message.content, message.title, options);
}
if (message.type === "success") {
this.refs.toastr.success(message.content, message.title, options);
}
};
Expand Down Expand Up @@ -711,7 +715,7 @@ var Login = React.createClass({
mixins: [Router.Navigation],

getInitialState: function () {
return { email: "", password: "", loading: false };
return { email: "", password: "", twoFactorCode: "", twoFactorRequired: false, loading: false };
},

componentDidMount: function () {
Expand All @@ -726,7 +730,7 @@ var Login = React.createClass({
if (AuthStore.getStatus().loggedIn) {
this.transitionTo("/posts");
}
this.setState({ loading: false });
this.setState({ loading: false, twoFactorRequired: AuthStore.message && AuthStore.message.otp });
},

_handleChangeEmail: function (event) {
Expand All @@ -737,24 +741,34 @@ var Login = React.createClass({
this.setState({ password: event.target.value });
},

_handleChangeTwoFactorCode: function (event) {
this.setState({ twoFactorCode: event.target.value });
},

_handleSubmit: function (event) {
event.preventDefault();


AuthActionCreators.logIn({
email: this.state.email,
password: this.state.password
password: this.state.password,
twoFactorCode: this.state.twoFactorCode
});
this.setState({ loading: true });
},

render: function () {
var errors = "";
var loginButton = "Log in";
var twoFactorInput = "";
if (this.state.loading) {
loginButton = React.createElement("i", { className: "fa fa-spinner fa-spin" });
}

if (this.state.twoFactorRequired) {
twoFactorInput = React.createElement("input", { ref: "twoFactorCode", type: "text", name: "twoFactorCode", onChange: this._handleChangeTwoFactorCode, placeholder: "Two factor code", title: "Enter your two factor code" });
}

return React.createElement(
"div",
{ id: "login" },
Expand All @@ -773,6 +787,7 @@ var Login = React.createClass({
{ onSubmit: this._handleSubmit },
React.createElement("input", { ref: "email", type: "text", name: "email", onChange: this._handleChangeEmail, placeholder: "Username or Email", title: "Enter your github username or email" }),
React.createElement("input", { ref: "password", type: "password", name: "password", onChange: this._handleChangePassword, placeholder: "Password", title: "Enter your github password" }),
twoFactorInput,
React.createElement(
"button",
{ type: "submit", className: "button success" },
Expand Down Expand Up @@ -3500,7 +3515,8 @@ AuthServices.prototype.login = function (credentials) {
var github = Github.renewInstance({
auth: "basic",
username: credentials.email,
password: credentials.password
password: credentials.password,
twoFactorCode: credentials.twoFactorCode
});

var context = Github.getContext();
Expand Down Expand Up @@ -3541,14 +3557,30 @@ AuthServices.prototype.login = function (credentials) {
}
});
})["catch"](function (error) {
console.error("AuthServices - login error", error);
var message = {
type: "error",
title: "Authentication"
};
var otpRequired;

if (error.request) {
var otp = error.request.getResponseHeader("X-GitHub-OTP") || "";
otpRequired = otp.split(";")[0] === "required";
}

if (otpRequired) {
console.log("AuthServices - OTP required : ", otpRequired);
message.type = "warning";
message.content = "A two-factor authentication code is needed.";
message.otp = true;
} else {
console.error("AuthServices - login error", error);
message.content = "An error has occurred, see your console for more informations.";
}

// Call action
AuthActionGHCreators.receiveAuthentication({
message: {
type: "error",
title: "Authentication",
content: "An error has occurred, see your console for more informations."
}
message: message
});
});
};
Expand Down
14 changes: 10 additions & 4 deletions hubpress/scripts/vendor.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3d476f4

Please sign in to comment.