Added a util function that checks that local/session storage is enabled. Also added tests using this function to report an error to the user if it is not enabled
Этот коммит содержится в:
@@ -21,6 +21,12 @@ var FindTeamDomain = React.createClass({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!utils.isLocalStorageSupported()) {
|
||||||
|
state.server_error = "This service requires local storage to be enabled. Please enable it or exit private browsing.";
|
||||||
|
this.setState(state);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
state.server_error = "";
|
state.server_error = "";
|
||||||
this.setState(state);
|
this.setState(state);
|
||||||
|
|
||||||
@@ -94,7 +100,7 @@ module.exports = React.createClass({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var email = this.refs.email.getDOMNode().value.trim();
|
var email = this.refs.email.getDOMNode().value.trim();
|
||||||
if (!email) {
|
if (!email) {
|
||||||
state.server_error = "An email is required"
|
state.server_error = "An email is required"
|
||||||
this.setState(state);
|
this.setState(state);
|
||||||
@@ -108,6 +114,12 @@ module.exports = React.createClass({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!utils.isLocalStorageSupported()) {
|
||||||
|
state.server_error = "This service requires local storage to be enabled. Please enable it or exit private browsing.";
|
||||||
|
this.setState(state);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
state.server_error = "";
|
state.server_error = "";
|
||||||
this.setState(state);
|
this.setState(state);
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,10 @@ var constants = require('../utils/constants.jsx')
|
|||||||
|
|
||||||
WelcomePage = React.createClass({
|
WelcomePage = React.createClass({
|
||||||
submitNext: function (e) {
|
submitNext: function (e) {
|
||||||
|
if (!utils.isLocalStorageSupported()) {
|
||||||
|
this.setState({ storage_error: "This service requires local storage to be enabled. Please enable it or exit private browsing."} );
|
||||||
|
return;
|
||||||
|
}
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.props.state.wizard = "team_name";
|
this.props.state.wizard = "team_name";
|
||||||
this.props.updateParent(this.props.state);
|
this.props.updateParent(this.props.state);
|
||||||
@@ -26,6 +30,12 @@ WelcomePage = React.createClass({
|
|||||||
if (!email || !utils.isEmail(email)) {
|
if (!email || !utils.isEmail(email)) {
|
||||||
state.email_error = "Please enter a valid email address";
|
state.email_error = "Please enter a valid email address";
|
||||||
this.setState(state);
|
this.setState(state);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (!utils.isLocalStorageSupported()) {
|
||||||
|
state.email_error = "This service requires local storage to be enabled. Please enable it or exit private browsing.";
|
||||||
|
this.setState(state);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
state.email_error = "";
|
state.email_error = "";
|
||||||
@@ -50,6 +60,7 @@ WelcomePage = React.createClass({
|
|||||||
|
|
||||||
client.track('signup', 'signup_team_01_welcome');
|
client.track('signup', 'signup_team_01_welcome');
|
||||||
|
|
||||||
|
var storage_error = this.state.storage_error ? <label className="control-label">{ this.state.storage_error }</label> : null;
|
||||||
var email_error = this.state.email_error ? <label className="control-label">{ this.state.email_error }</label> : null;
|
var email_error = this.state.email_error ? <label className="control-label">{ this.state.email_error }</label> : null;
|
||||||
var server_error = this.state.server_error ? <div className={ "form-group has-error" }><label className="control-label">{ this.state.server_error }</label></div> : null;
|
var server_error = this.state.server_error ? <div className={ "form-group has-error" }><label className="control-label">{ this.state.server_error }</label></div> : null;
|
||||||
|
|
||||||
@@ -66,6 +77,7 @@ WelcomePage = React.createClass({
|
|||||||
</p>
|
</p>
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<button className="btn-primary btn form-group" onClick={this.submitNext}><i className="glyphicon glyphicon-ok"></i>Yes, this address is correct</button>
|
<button className="btn-primary btn form-group" onClick={this.submitNext}><i className="glyphicon glyphicon-ok"></i>Yes, this address is correct</button>
|
||||||
|
{ storage_error }
|
||||||
</div>
|
</div>
|
||||||
<hr />
|
<hr />
|
||||||
<p>If this is not correct, you can switch to a different email. We'll send you a new invite right away.</p>
|
<p>If this is not correct, you can switch to a different email. We'll send you a new invite right away.</p>
|
||||||
|
|||||||
@@ -96,6 +96,21 @@ module.exports.getCookie = function(name) {
|
|||||||
if (parts.length == 2) return parts.pop().split(";").shift();
|
if (parts.length == 2) return parts.pop().split(";").shift();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module.exports.isLocalStorageSupported = function() {
|
||||||
|
try {
|
||||||
|
sessionStorage.setItem("testSession", '1');
|
||||||
|
sessionStorage.removeItem("testSession");
|
||||||
|
|
||||||
|
localStorage.setItem("testLocal", '1');
|
||||||
|
localStorage.removeItem("testLocal", '1');
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
module.exports.notifyMe = function(title, body, channel) {
|
module.exports.notifyMe = function(title, body, channel) {
|
||||||
if ("Notification" in window && Notification.permission !== 'denied') {
|
if ("Notification" in window && Notification.permission !== 'denied') {
|
||||||
Notification.requestPermission(function (permission) {
|
Notification.requestPermission(function (permission) {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user