removed change password UI for oauth accounts

This commit is contained in:
JoramWilander
2015-07-15 17:50:07 -04:00
parent c39e95c7cb
commit 712f9a0b8c
3 changed files with 49 additions and 30 deletions

View File

@@ -112,6 +112,9 @@ module.exports = React.createClass({
<div className="form-group">
<button type="submit" className="btn btn-primary">Sign in</button>
</div>
<div className="form-group form-group--small">
<span><a href="#">{"Log in with GitLab"}</a></span>
</div>
<div className="form-group form-group--small">
<span><a href="/find_team">{"Find other " + strings.TeamPlural}</a></span>
</div>

View File

@@ -20,7 +20,7 @@ module.exports = React.createClass({
<hr />
{ server_error }
{ client_error }
<a className="btn btn-sm btn-primary" onClick={this.props.submit}>Submit</a>
{ this.props.submit ? <a className="btn btn-sm btn-primary" onClick={this.props.submit}>Submit</a> : "" }
<a className="btn btn-sm theme" href="#" onClick={this.props.updateSection}>Cancel</a>
</li>
</ul>

View File

@@ -590,7 +590,7 @@ var SecurityTab = React.createClass({
submitPassword: function(e) {
e.preventDefault();
var user = UserStore.getCurrentUser();
var user = this.props.user;
var currentPassword = this.state.current_password;
var newPassword = this.state.new_password;
var confirmPassword = this.state.confirm_password;
@@ -648,53 +648,69 @@ var SecurityTab = React.createClass({
var self = this;
if (this.props.activeSection === 'password') {
var inputs = [];
var submit = null;
inputs.push(
<div className="form-group">
<label className="col-sm-5 control-label">Current Password</label>
<div className="col-sm-7">
<input className="form-control" type="password" onChange={this.updateCurrentPassword} value={this.state.current_password}/>
if (this.props.user.auth_service === "") {
inputs.push(
<div className="form-group">
<label className="col-sm-5 control-label">Current Password</label>
<div className="col-sm-7">
<input className="form-control" type="password" onChange={this.updateCurrentPassword} value={this.state.current_password}/>
</div>
</div>
</div>
);
inputs.push(
<div className="form-group">
<label className="col-sm-5 control-label">New Password</label>
<div className="col-sm-7">
<input className="form-control" type="password" onChange={this.updateNewPassword} value={this.state.new_password}/>
);
inputs.push(
<div className="form-group">
<label className="col-sm-5 control-label">New Password</label>
<div className="col-sm-7">
<input className="form-control" type="password" onChange={this.updateNewPassword} value={this.state.new_password}/>
</div>
</div>
</div>
);
inputs.push(
<div className="form-group">
<label className="col-sm-5 control-label">Retype New Password</label>
<div className="col-sm-7">
<input className="form-control" type="password" onChange={this.updateConfirmPassword} value={this.state.confirm_password}/>
);
inputs.push(
<div className="form-group">
<label className="col-sm-5 control-label">Retype New Password</label>
<div className="col-sm-7">
<input className="form-control" type="password" onChange={this.updateConfirmPassword} value={this.state.confirm_password}/>
</div>
</div>
</div>
);
);
submit = this.submitPassword;
} else {
inputs.push(
<div className="form-group">
<label className="col-sm-12">Log in occurs through GitLab. Please see your GitLab account settings page to update your password.</label>
</div>
);
}
passwordSection = (
<SettingItemMax
title="Password"
inputs={inputs}
submit={this.submitPassword}
submit={submit}
server_error={server_error}
client_error={password_error}
updateSection={function(e){self.props.updateSection("");e.preventDefault();}}
/>
);
} else {
var d = new Date(this.props.user.last_password_update);
var hour = d.getHours() % 12 ? String(d.getHours() % 12) : "12";
var min = d.getMinutes() < 10 ? "0" + d.getMinutes() : String(d.getMinutes());
var timeOfDay = d.getHours() >= 12 ? " pm" : " am";
var dateStr = "Last updated " + Constants.MONTHS[d.getMonth()] + " " + d.getDate() + ", " + d.getFullYear() + " at " + hour + ":" + min + timeOfDay;
var describe;
if (this.props.user.auth_service === "") {
var d = new Date(this.props.user.last_password_update);
var hour = d.getHours() % 12 ? String(d.getHours() % 12) : "12";
var min = d.getMinutes() < 10 ? "0" + d.getMinutes() : String(d.getMinutes());
var timeOfDay = d.getHours() >= 12 ? " pm" : " am";
describe = "Last updated " + Constants.MONTHS[d.getMonth()] + " " + d.getDate() + ", " + d.getFullYear() + " at " + hour + ":" + min + timeOfDay;
} else {
describe = "Log in done through GitLab"
}
passwordSection = (
<SettingItemMin
title="Password"
describe={dateStr}
describe={describe}
updateSection={function(){self.props.updateSection("password");}}
/>
);