Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
d2828bab
Commit
d2828bab
authored
12 years ago
by
Randolph Carter
Browse files
Options
Downloads
Patches
Plain Diff
fixes default email sender address
parent
3adfb91a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
core/ajax/share.php
+1
-5
1 addition, 5 deletions
core/ajax/share.php
core/lostpassword/controller.php
+1
-1
1 addition, 1 deletion
core/lostpassword/controller.php
lib/public/util.php
+36
-0
36 additions, 0 deletions
lib/public/util.php
with
38 additions
and
6 deletions
core/ajax/share.php
+
1
−
5
View file @
d2828bab
...
...
@@ -89,12 +89,8 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
if
(
$type
===
'dir'
)
$text
=
(
string
)
$l
->
t
(
'User %s shared the folder "%s" with you. It is available for download here: %s'
,
array
(
$user
,
$file
,
$link
));
// handle localhost installations
$server_host
=
OCP\Util
::
getServerHost
();
if
(
$server_host
===
'localhost'
)
$server_host
=
"example.com"
;
$default_from
=
'sharing-noreply@'
.
$server_host
;
$default_from
=
OCP\Util
::
getDefaultEmailAddress
(
'sharing-noreply'
)
;
$from_address
=
OCP\Config
::
getUserValue
(
$user
,
'settings'
,
'email'
,
$default_from
);
// send it out now
...
...
This diff is collapsed.
Click to expand it.
core/lostpassword/controller.php
+
1
−
1
View file @
d2828bab
...
...
@@ -43,7 +43,7 @@ class OC_Core_LostPassword_Controller {
$tmpl
->
assign
(
'link'
,
$link
,
false
);
$msg
=
$tmpl
->
fetchPage
();
$l
=
OC_L10N
::
get
(
'core'
);
$from
=
'lostpassword-noreply@'
.
OCP\Util
::
getServerHost
(
);
$from
=
OCP\Util
::
getDefaultEmailAddress
(
'lostpassword-noreply'
);
OC_Mail
::
send
(
$email
,
$_POST
[
'user'
],
$l
->
t
(
'ownCloud password reset'
),
$msg
,
$from
,
'ownCloud'
);
echo
(
'Mailsent'
);
...
...
This diff is collapsed.
Click to expand it.
lib/public/util.php
+
36
−
0
View file @
d2828bab
...
...
@@ -172,6 +172,42 @@ class Util {
return
(
\OC_Request
::
serverHost
());
}
/**
* @brief returns the server hostname
* @returns the server hostname
*
* Returns the server host name without an eventual port number
*/
public
static
function
getServerHostName
()
{
$host_name
=
self
::
getServerHost
();
// strip away port number (if existing)
$colon_pos
=
strpos
(
$host_name
,
':'
);
if
(
$colon_pos
!=
FALSE
)
{
$host_name
=
substr
(
$host_name
,
0
,
$colon_pos
);
}
return
$host_name
;
}
/**
* @brief Returns the default email address
* @param $user_part the user part of the address
* @returns the default email address
*
* Assembles a default email address (using the server hostname
* and the given user part, and returns it
* Example: when given lostpassword-noreply as $user_part param,
* and is currently accessed via http(s)://example.com/,
* it would return 'lostpassword-noreply@example.com'
*/
public
static
function
getDefaultEmailAddress
(
$user_part
)
{
$host_name
=
self
::
getServerHostName
();
// handle localhost installations
if
(
$server_host
===
'localhost'
)
{
$server_host
=
"example.com"
;
}
return
$user_part
.
'@'
.
$host_name
;
}
/**
* @brief Returns the server protocol
* @returns the server protocol
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment