| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- ///<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', uri: '/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);
|