コード例 #1
0
func (h *TenantHandler) AddUserToTenant(u session.AuthCertificate, users []InviteUsers) {
	for _, user := range users {
		var inputParams map[string]string
		inputParams = make(map[string]string)
		inputParams["email"] = user.Email
		inputParams["name"] = user.Name
		inputParams["userID"] = user.UserID
		inputParams["tenantID"] = u.Domain
		inputParams["FromName"] = u.Username
		inputParams["FromID"] = u.UserID
		inputParams["FromEmail"] = u.Email
		req := InviteUserRequest{}
		req.UserID = user.UserID
		req.TenantID = u.Domain
		req.RequestToken = common.RandText(10)
		req.Name = user.Name
		req.FromUserID = u.UserID
		req.FromName = u.Name
		req.FromEmail = u.Email
		req.Email = user.Email
		req.SecurityLevel = user.SecurityLevel

		//h.AddUsersToTenant(t.TenantID, user.UserID, "admin")
		client.Go("ignore", "com.duosoftware.tenant", "userrequest").StoreObject().WithKeyField("RequestToken").AndStoreOne(req).Ok()
		email.Send("ignore", "com.duosoftware.auth", "tenant", "tenant_request", inputParams, user.Email)
	}
}
コード例 #2
0
ファイル: authHandler.go プロジェクト: sajeetharan/v6engine
func (h *AuthHandler) GetAuthCode(ApplicationID, UserID, URI string) string {
	var a AuthCode
	a.ApplicationID = ApplicationID
	a.UserID = UserID
	a.URI = URI
	a.Code = common.RandText(10)
	client.Go("ignore", "com.duosoftware.auth", "authcode").StoreObject().WithKeyField("Code").AndStoreOne(a).Ok()
	term.Write("GetAuthCode for "+ApplicationID+" with SecurityToken :"+UserID, term.Debug)
	return a.Code
}
コード例 #3
0
ファイル: main.go プロジェクト: sajeetharan/v6engine
func Informaton() {
	count := 10
	for i := 0; i < count; i++ {
		stats := stat.States{}
		stats.MethodName = common.RandText(10)
		stats.NameSpace = "Lasitha"
		stats.ObjectSize = 10
		stats.ElapsedTime = 1
		stats.Status = stat.Sucess
		stat.Add(stats)
	}
}
コード例 #4
0
ファイル: authHandler.go プロジェクト: sajeetharan/v6engine
func (h *AuthHandler) SaveUser(u User, update bool) User {
	term.Write("SaveUser saving user  "+u.Name, term.Debug)

	bytes, err := client.Go("ignore", "com.duosoftware.auth", "users").GetOne().ByUniqueKey(u.EmailAddress).Ok()
	if err == "" {
		var uList User
		err := json.Unmarshal(bytes, &uList)
		//if err == nil || bytes == nil {
		if err != nil {
			u.Active = false
			u.UserID = common.GetGUID()
			term.Write("SaveUser saving user  "+u.Name+" New User "+u.UserID, term.Debug)
			password := u.Password
			u.Password = common.GetHash(u.Password)
			u.ConfirmPassword = common.GetHash(u.ConfirmPassword)
			var Activ ActivationEmail
			Activ.GUUserID = u.EmailAddress
			Activ.Token = common.RandText(10)
			var inputParams map[string]string
			inputParams = make(map[string]string)
			inputParams["email"] = u.EmailAddress
			inputParams["name"] = u.Name
			inputParams["token"] = Activ.Token
			inputParams["password"] = password
			email.Send("ignore", "com.duosoftware.auth", "email", "user_activate", inputParams, u.EmailAddress)
			term.Write("E Mail Sent", term.Debug)
			client.Go("ignore", "com.duosoftware.auth", "activation").StoreObject().WithKeyField("Token").AndStoreOne(Activ).Ok()
			term.Write("Activation stored", term.Debug)
			client.Go("ignore", "com.duosoftware.auth", "users").StoreObject().WithKeyField("EmailAddress").AndStoreOne(u).Ok()
		} else {
			if update {
				u.UserID = uList.UserID
				u.Password = common.GetHash(u.Password)
				u.ConfirmPassword = common.GetHash(u.Password)
				term.Write("SaveUser saving user  "+u.Name+" Update User "+u.UserID, term.Debug)
				client.Go("ignore", "com.duosoftware.auth", "users").StoreObject().WithKeyField("EmailAddress").AndStoreOne(u).Ok()
			}
		}
		//} else {
		//term.Write("SaveUser saving user store Error #"+err.Error(), term.Error)
		//}
	} else {
		term.Write("SaveUser saving user fetech Error #"+err, term.Error)
	}
	u.Password = "******"
	u.ConfirmPassword = "******"
	return u
}
コード例 #5
0
ファイル: authHandler.go プロジェクト: sajeetharan/v6engine
func (h *AuthHandler) ForgetPassword(emailaddress string) bool {
	u, error := h.GetUser(emailaddress)
	if error == "" {
		passowrd := common.RandText(6)
		u.ConfirmPassword = passowrd
		u.Password = passowrd
		term.Write("Password : "******"email"] = u.EmailAddress
		inputParams["name"] = u.Name
		inputParams["password"] = passowrd
		email.Send("ignore", "com.duosoftware.auth", "email", "user_resetpassword", inputParams, u.EmailAddress)
		term.Write("E Mail Sent", term.Debug)
		return true
	}
	return false
}