mirror of
https://github.com/grafana/grafana.git
synced 2025-02-20 11:48:34 -06:00
63 lines
1.5 KiB
TypeScript
63 lines
1.5 KiB
TypeScript
///<reference path="../../headers/common.d.ts" />
|
|
|
|
import config from 'app/core/config';
|
|
import coreModule from '../core_module';
|
|
|
|
export class SignUpCtrl {
|
|
|
|
/** @ngInject */
|
|
constructor(
|
|
private $scope: any,
|
|
private backendSrv: any,
|
|
$location: any,
|
|
contextSrv: any) {
|
|
|
|
contextSrv.sidemenu = false;
|
|
$scope.ctrl = this;
|
|
|
|
$scope.formModel = {};
|
|
|
|
var params = $location.search();
|
|
$scope.formModel.orgName = params.email;
|
|
$scope.formModel.email = params.email;
|
|
$scope.formModel.username = params.email;
|
|
$scope.formModel.code = params.code;
|
|
|
|
$scope.verifyEmailEnabled = false;
|
|
$scope.autoAssignOrg = false;
|
|
|
|
$scope.navModel = {
|
|
main: {
|
|
icon: 'gicon gicon-branding',
|
|
subTitle: 'Register your Grafana account',
|
|
breadcrumbs: [
|
|
{ title: 'Login', url: '/login' },
|
|
{ title: 'Sign Up' },
|
|
]
|
|
}
|
|
};
|
|
|
|
backendSrv.get('/api/user/signup/options').then(options => {
|
|
$scope.verifyEmailEnabled = options.verifyEmailEnabled;
|
|
$scope.autoAssignOrg = options.autoAssignOrg;
|
|
});
|
|
}
|
|
|
|
submit () {
|
|
if (!this.$scope.signUpForm.$valid) {
|
|
return;
|
|
}
|
|
|
|
this.backendSrv.post('/api/user/signup/step2', this.$scope.formModel).then(rsp => {
|
|
if (rsp.code === 'redirect-to-select-org') {
|
|
window.location.href = config.appSubUrl + '/profile/select-org?signup=1';
|
|
} else {
|
|
window.location.href = config.appSubUrl + '/';
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
coreModule.controller('SignUpCtrl', SignUpCtrl);
|
|
|