summaryrefslogtreecommitdiff
path: root/email.go
diff options
context:
space:
mode:
authorhorus_arch2015-03-19 13:39:37 +0100
committerhorus_arch2015-03-19 13:39:37 +0100
commitf334c93c0364d14a2b55641b155ad58f715a4b39 (patch)
tree63ffbfc845f441802bd59c07adf2d9fe2f86c4bc /email.go
parent3c9bdbc66998075278f7d79fa10709e7fab5deb6 (diff)
downloadfreemail-f334c93c0364d14a2b55641b155ad58f715a4b39.tar.gz
Rewriting from scratch.
Diffstat (limited to 'email.go')
-rw-r--r--email.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/email.go b/email.go
new file mode 100644
index 0000000..150b7fb
--- /dev/null
+++ b/email.go
@@ -0,0 +1,29 @@
+package main
+
+import (
+ "log"
+)
+
+func EmailExists(email string) bool {
+ vU := VirtualUser{}
+ query := Db.Where(map[string]interface{}{"email": email}).Find(&vU)
+ if query.Error != nil {
+ log.Println(query.Error)
+ return false
+ }
+ if vU.Email == "" {
+ return false
+ }
+ return true
+}
+
+func CreateEmail(email, password string) (bool, error) {
+ vU := VirtualUser{Email: email, Password: password}
+ if !Db.Debug().NewRecord(vU) {
+ log.Println("Creating new record failed.")
+ return false, nil
+ }
+ Db.Debug().Create(&vU)
+
+ return true, nil
+}